#pragma once
#pragma warning(disable:4996)       // disable checked iterator errors http://msdn.microsoft.com/en-us/library/aa985965(VS.80).aspx 

//
// Copyright (C) 2011 Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.101

#include <Macros.h>
#include <CoVector.h>
#include <CoMatrix.h>
#include <CoCube.h>
#include <ValueHelpers.h>
#include <Settings.h>

#include <gen/QL/Cashflows/Coupon.h>
#pragma unmanaged 
#include <ql\cashflows\inflationcoupon.hpp>
#include <boost/smart_ptr/detail/spinlock.hpp>
#pragma managed 

using namespace System;
using namespace QuantLib;
using namespace Cephei;

using namespace Cephei::QL::Times;
using namespace Cephei::QL::Indexes;
using namespace Cephei::QL::Termstructures;
#define HANDLE
#define ABSTRACT
#undef STRUCT
namespace Cephei { namespace QL { namespace Cashflows {
	//////////////////////////////////////////////////////////////////////////////////////////////
	// implementation of IInflationCoupon
	public ref class CInflationCoupon : 
            public CCoupon,
            public Cephei::QL::Cashflows::IInflationCoupon
	{
	protected: 
		boost::shared_ptr<QuantLib::InflationCoupon>* _ppInflationCoupon;
#ifdef HANDLE
		QuantLib::Handle<QuantLib::InflationCoupon>* _phInflationCoupon;
#endif
		Object^ _InflationCouponOwner;     // reference to object that manages the storage for this object
	internal:
        CInflationCoupon (boost::shared_ptr<QuantLib::InflationCoupon>& childNative, Object^ owner);
        CInflationCoupon (QuantLib::InflationCoupon& childNative, Object^ owner);
        CInflationCoupon (CInflationCoupon^ copy);
        CInflationCoupon (System::Type^ t);
#ifdef STRUCT
        CInflationCoupon (QuantLib::InflationCoupon childNative);
#endif       
#ifdef HANDLE
		CInflationCoupon (QuantLib::Handle<QuantLib::InflationCoupon>& childNative, Object^ owner);
		CInflationCoupon (QuantLib::Handle<QuantLib::InflationCoupon> childNative);
#endif
		virtual ~CInflationCoupon ();
		!CInflationCoupon ();

	internal:
		QuantLib::InflationCoupon& GetReference ();
		boost::shared_ptr<QuantLib::InflationCoupon>& GetShared ();
		QuantLib::InflationCoupon* GetPointer ();
        void SetInflationCoupon (boost::shared_ptr<QuantLib::InflationCoupon> native)
        {
            if (_ppInflationCoupon != NULL)
                delete _ppInflationCoupon;
            _ppInflationCoupon = new boost::shared_ptr<QuantLib::InflationCoupon> (native);
            SetCoupon (boost::dynamic_pointer_cast<QuantLib::Coupon> (*_ppInflationCoupon));
        }
#ifdef HANDLE
		QuantLib::Handle<QuantLib::InflationCoupon>& GetHandle ();
#endif
		virtual bool HasNative () override;
    public:
		virtual Double AccruedAmount (DateTime d) ;
        property Double Amount 
        {
		    virtual Double get () ;
        }
        property Cephei::QL::Times::IDayCounter^ DayCounter 
        {
		    virtual Cephei::QL::Times::IDayCounter^ get () ;
        }
        property DateTime FixingDate 
        {
		    virtual DateTime get () ;
        }
        property UInt32 FixingDays 
        {
		    virtual UInt32 get () ;
        }
        property Cephei::QL::Indexes::IInflationIndex^ Index 
        {
		    virtual Cephei::QL::Indexes::IInflationIndex^ get () ;
        }
        property Double IndexFixing 
        {
		    virtual Double get () ;
        }
        property Cephei::QL::Times::IPeriod^ ObservationLag 
        {
		    virtual Cephei::QL::Times::IPeriod^ get () ;
        }
		virtual Double Price (Cephei::QL::Termstructures::IYieldTermStructure^ discountingCurve) ;
        property Cephei::QL::Cashflows::IInflationCouponPricer^ Pricer 
        {
		    virtual Cephei::QL::Cashflows::IInflationCouponPricer^ get () ;
        }
        property Double Rate 
        {
		    virtual Double get () ;
        }
		virtual Cephei::QL::Cashflows::IInflationCoupon^ SetPricer (Cephei::QL::Cashflows::IInflationCouponPricer^ pricer) ;
        property Cephei::QL::Cashflows::IInflationCoupon^ Update 
        {
		    virtual Cephei::QL::Cashflows::IInflationCoupon^ get () ;
        }
        property Double M2981_Amount 
        {
            virtual Double get () = Cephei::QL::ICashFlow::Amount::get
            {
                return ((Cephei::QL::Cashflows::IInflationCoupon^)this)->Amount;
            }
        }
    };
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Factory class
	public ref class CInflationCoupon_Factory : public System::MarshalByRefObject,  public IInflationCoupon_Factory
	{
	public:
    };
   
/*Cephei*/ } /*QL*/ } /*Cashflows */}
